package com.klarna.raas.util;

import org.apache.camel.Exchange;

import com.klarna.raas.RequestHeaderConstants;
import com.klarna.raas.datamodel.ifs.IRequest;

public class RequestHeadersBuilder {

	public static void buildReqHeaders(Exchange exchange, IRequest request) {
		if (exchange != null && request != null) {
	        exchange.getIn().setHeader(RequestHeaderConstants.ID, request.getId().toString());
	        exchange.getIn().setHeader(RequestHeaderConstants.CUSTOMERID, request.getCustomerId().toString());
	        exchange.getIn().setHeader(RequestHeaderConstants.FIRSTNAME, request.getFirstName());
	        exchange.getIn().setHeader(RequestHeaderConstants.LASTNAME, request.getLastName());
	        exchange.getIn().setHeader(RequestHeaderConstants.STREET, request.getStreet());
	        exchange.getIn().setHeader(RequestHeaderConstants.CITY, request.getCity());
	        exchange.getIn().setHeader(RequestHeaderConstants.ZIP, request.getZip());
	        exchange.getIn().setHeader(RequestHeaderConstants.CAREOF, request.getCareOf());
	        exchange.getIn().setHeader(RequestHeaderConstants.COUNTRY, request.getCountry());
	        exchange.getIn().setHeader(RequestHeaderConstants.EMAIL, request.getEmail());
	        exchange.getIn().setHeader(RequestHeaderConstants.BIRTHDATE, request.getBirthDate());
	        exchange.getIn().setHeader(RequestHeaderConstants.CLIENTIP, request.getClientIP());
	        exchange.getIn().setHeader(RequestHeaderConstants.PURCHASEAMOUNT, request.getPurchaseAmount().toString());
	        exchange.getIn().setHeader(RequestHeaderConstants.ESTOREID, request.getEstoreId());
		} else {
			throw new IllegalArgumentException("exchange=" + exchange + ", request=" + request);
		}
		
	}

}
